import Vue from 'vue'

const apiUrl = 'api/'

export default {
  getDict () {
    return Vue.http.get(apiUrl + 'dict')
  },
  save (dict) {
    if (dict.pkid) {
      return Vue.http.put(apiUrl + 'dict', dict)
    } else {
      return Vue.http.post(apiUrl + 'dict', dict)
    }
  },
  del (pkid) {
    return Vue.http.delete(apiUrl + 'dict/' + pkid)
  },
  getNodes (pkid) {
    return Vue.http.get(apiUrl + 'dict/' + pkid + '/node')
  }
}
